-
Couldn't load subscription status.
- Fork 13.9k
CI: use alternative disks if available #148146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
b040885 to
4848df3
Compare
This comment has been minimized.
This comment has been minimized.
4848df3 to
357f10f
Compare
This comment has been minimized.
This comment has been minimized.
357f10f to
d288956
Compare
This comment has been minimized.
This comment has been minimized.
d288956 to
014c722
Compare
This comment has been minimized.
This comment has been minimized.
cleaning up disk space takes a lot of time
014c722 to
53b6d43
Compare
|
r? @marcoieni rustbot has assigned @marcoieni. Use |
| # The availability of the disks we're probing isn't guaranteed, | ||
| # so this is opportunistic. | ||
| checkAlternative() { | ||
| local mountpoint="/mnt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find confusing naming the variable as the mountpoint command
| local mntopts="defaults,discard,journal_async_commit,barrier=0,noauto_da_alloc,lazytime,data=writeback" | ||
|
|
||
| # GHA has a 2nd disk mounted at /mnt that is almost empty | ||
| if mountpoint /mnt && [ "$available_space_kb" -ge "$space_target_kb" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we reuse the variable instead of hardcoding /mnt?
| # ignore-tidy-linelength | ||
| local mntopts="defaults,discard,journal_async_commit,barrier=0,noauto_da_alloc,lazytime,data=writeback" | ||
|
|
||
| # GHA has a 2nd disk mounted at /mnt that is almost empty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # GHA has a 2nd disk mounted at /mnt that is almost empty | |
| # GHA has a 2nd disk mounted at /mnt that is almost empty. | |
| # Check if it's a valid mountpoint and it has enough available space. |
| sudo mount $blkdev ./obj -o $mntopts || sudo dmesg | tail -n 20 | ||
| sudo chown -R "$USER":"$USER" ./obj | ||
|
|
||
| exit 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| exit 0 | |
| # Exit from this script to avoid wasting time removing disk space, | |
| # as we already have enough disk space in the alternative drive. | |
| exit 0 |
| local blkdev=$(df -k "$mountpoint" --output=source | tail -n 1) | ||
| echo "Sufficient space available on $blkdev mounted at $mountpoint" | ||
| sudo swapoff -a || true | ||
| mkdir ./obj | ||
| # remount with O_EATMYDATA while we're at it | ||
| sudo umount /mnt | ||
| sudo mount $blkdev ./obj -o $mntopts || sudo dmesg | tail -n 20 | ||
| sudo chown -R "$USER":"$USER" ./obj |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add more comments explaining what you are doing here? 🙏
|
I have no objections if this works as it seems faster than freeing up disk space 🙌 |

cleaning up disk space takes a lot of time, sometimes 30 minutes